<?php
class Authority {
	private $level = 0; //个人好感度等级
	private $clusterLevel = 0; //当前群好感度等级
	private $adminLevel = 0; // 权限级别 0普通   1管理    2主人
	private $isClusterAdmin = 0; //是否为群管理  0普通群员 1群管理 2群主
	function Authority($flag=false) {

		$this->init($flag);
	}

	private function init($flag) {
		global $admin;
		$favor = Favorable :: getFavLev($_POST[ClusterNum]);
		$this->clusterLevel = $favor['lv'];
		if (null != $admin[$_POST[Sender]]) {
			$this->adminLevel = $admin[$_POST[Sender]];
		}
		
		
		if($flag)
			$this->isClusterAdmin = $this->getClusterAdmin($_POST[ClusterNum],$_POST[Sender]);

	}

	public function getClusterAdmin($c,$s) {
		//$api = new Api("IsClusterAdmin");
		$lv1 = (int)$_POST[IsAdmin];//$api->doApi($c, $s);
		
		$ret = @ DB :: GetQueryResult("select * from td_cluster_admin where qq='{$s}' and clusternum='{$c}'", true);
		$lv1 = (int) $lv1;
		$lv2 = -1;
		if ($ret) {
			$lv2 = $ret[lv];
		}
		return $lv1 > $lv2 ? $lv1 : $lv2;
	}
	private function __get($property_name) {
		return $this-> $property_name;

	}

	private function __set($property_name, $value) {
		$this->$property_name = $value;
	}
}
?>